package com.lantu.wisdom.controller;


import com.lantu.framework.common.utils.BeanMapper;
import com.lantu.framework.common.utils.PageQueryResult;
import com.lantu.framework.common.utils.ResponseWrapper;
import com.lantu.paycommon.utils.StringUtil;
import com.lantu.wisdom.dto.AddAppraisalTypeDTO;
import com.lantu.wisdom.dto.SearchAppraisalTypeDTO;
import com.lantu.wisdom.dto.vo.SearchAppraisalTypeVO;
import com.lantu.wisdom.service.WAppraisalTypeApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 鉴定类型表 前端控制器
 * </p>
 *
 * @author zch
 * @since 2021-06-15
 */
@RestController
@RequestMapping("/wAppraisalType")
@Api(tags = {"类型相关"})
public class WAppraisalTypeController {


    @Autowired
    WAppraisalTypeApi ltAppraisalTypeApi;

    @ApiOperation(value = "添加鉴定类型")
    @RequestMapping(value = "/addAppraisalType", method = RequestMethod.POST)
    public ResponseWrapper addAuthority(@RequestBody @Validated AddAppraisalTypeDTO dto) {
        return ltAppraisalTypeApi.addAppraisalType(dto) ? ResponseWrapper.success() : ResponseWrapper.exception();
    }


    @ApiOperation(value = "初始化首页数据")
    @RequestMapping(value = "/getAppraisalTypeList", method = RequestMethod.POST)
    public ResponseWrapper<List<SearchAppraisalTypeDTO>> getAuthorityList() {
        List<SearchAppraisalTypeDTO> appraisalTypeList = ltAppraisalTypeApi.getAppraisalTypeList();
        return ResponseWrapper.success(appraisalTypeList);
    }

    @ApiOperation(value = "首页推荐")
    @RequestMapping(value = "/introduction", method = RequestMethod.GET)
    public ResponseWrapper<List<SearchAppraisalTypeVO>> introduction() {
        List<SearchAppraisalTypeVO> appraisalTypeList = ltAppraisalTypeApi.MainPageIntroduction();
        return ResponseWrapper.success(appraisalTypeList);
    }





    @ApiOperation(value = "根据typeCode查询")
    @RequestMapping(value = "/getAppraisalTypeByCode/{code}", method = RequestMethod.GET)
    public ResponseWrapper<List<SearchAppraisalTypeVO>> getAuthority(@PathVariable String code) {
        List<SearchAppraisalTypeVO> appraisalTypeList = ltAppraisalTypeApi.getAppraisalTypeByCode(code);
        return ResponseWrapper.success(appraisalTypeList);
    }





}

